#define DEBUG
#include <cstdio>
#include <cstring>

using namespace std;

const int maxn=10000, maxw=5000, inf=0x7ffffff;

int min(int a, int b) {
  return a<b ? a : b;
}

void push(int a, int b, int w, int &n, int f[][maxw+1], int t[][2]) {
  n++;
  t[n][0] = a, t[n][1] = b;
  for (int i=0; i<a; i++) {
    f[n][i] = f[n-1][i];
  }
  for (int i=a; i<=w; i++) {
    f[n][i] = min(f[n-1][i], f[n-1][i-a]+b);
  }
}

void dec(int &fn, int f[][maxw+1], int u[][2], int &gn, int g[][maxw+1], int v[][2], int w) {
  if (!fn) {
    for (; gn>0; gn--) {
      push(v[gn][0], v[gn][1], w, fn, f, u);
    }
  }
  fn--;
}

bool check(int a, int f[][maxw+1], int b, int g[][maxw+1], int w, int k) {
  for (int i=0; i<=w; i++) {
    if (f[a][i]+g[b][w-i]<=k) {
      return true;
    }
  }
  return false;
}

int main() {
  freopen("cactus.in", "r", stdin);
  freopen("cactus.out", "w", stdout);

  static int a[maxn+1], b[maxn+1], u[maxn+1][2], v[maxn+1][2], f[maxn+1][maxw+1], g[maxn+1][maxw+1], fn=0, gn=0;
  int s, w, k;
  scanf("%d %d %d", &s, &w, &k);
  for (int i=1; i<=s; i++) {
    scanf("%d %d", a+i, b+i);
  }

  memset(f[0], 60, sizeof f[0]);
  memset(g[0], 60, sizeof g[0]);
  f[0][0] = g[0][0] = 0;
  int ans=inf;
  for (int l=1, r=0; r<=s; l++) {
    if (l>r) {
      r++;
      push(a[r], b[r], w, gn, g, v);
    }
    for (; !check(fn, f, gn, g, w, k) && r<s;) {
      r++;
      push(a[r], b[r], w, gn, g, v);
    }
    if (check(fn, f, gn, g, w, k)) {
      ans = min(ans, r-l+1);
    }
    dec(fn, f, u, gn, g, v, w);
  }

  printf("%d", ans);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
